﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MWTWorkUnitMgmtTool.DataAccess.TableGatewayRepository;

namespace MWTWorkUnitMgmtTool.Services
{
    public class SpecialWorkunitService:ISpecialWorkunitService
    {

        private ISpecialWorkunitRepository _specialWorkunitRepository;

        public SpecialWorkunitService(ISpecialWorkunitRepository specialWorkunitRepository)
        {
            _specialWorkunitRepository = specialWorkunitRepository;
        }

        #region ISpecialWorkunitService Members

        public IEnumerable<BusinessEntities.SpecialWorkunit> GetAllSpecialWorkunits()
        {
            return _specialWorkunitRepository.GetAllSpecialWorkunits().Select(f => ObjectFactories.ObjectFactory.SpecialWorkunitFactory(f));
        }

        public int InsertSpecialWorkunit(string wuCode, string wuName, string type, string facility)
        {
            return _specialWorkunitRepository.InsertSpecialWorkunit(wuCode, wuName, type, facility); 
        }

        public int UpdateSpecialWorkunit(string wuCode, string wuName, string type, string facility)
        {
            return _specialWorkunitRepository.UpdateSpecialWorkunit(wuCode, wuName, type, facility); 
        }

        public int DeleteSpecialWorkunit(string wuCode)
        {
            return _specialWorkunitRepository.DeleteSpecialWorkunit(wuCode);
        }

        #endregion

    }
}
